package com.grantheath.erebus.model 
{
	import com.grantheath.erebus.model.enum.names.ErebusProxyNames;
	import com.grantheath.erebus.model.enum.notifications.ErebusAppStageNotifications;
	import com.grantheath.erebus.model.interfaces.IErebusLayersProxy;

	import flash.display.DisplayObjectContainer;

	import org.puremvc.as3.patterns.proxy.Proxy;

	/**
	 * @author grantheath
	 */
	public class ErebusLayersProxy extends Proxy implements IErebusLayersProxy 
	{
		private var _layers : Object;
		private var _appStage : DisplayObjectContainer;
		private var _defaultLayer : DisplayObjectContainer;
		private var _defaultPreloaderLayer : DisplayObjectContainer;
		
		public function ErebusLayersProxy()
		{
			super(ErebusProxyNames.LAYERS_PROXY);
			_layers = new Object();
		}
		
		public function addLayerById(layerId : String, layer : DisplayObjectContainer) : void
		{
			_layers[layerId] = layer;
			sendNotification(ErebusAppStageNotifications.ADD_LAYER, layer);
		}

		public function getLayerById(layerId : String) : DisplayObjectContainer
		{
			return _layers[layerId] as DisplayObjectContainer;
		}
		
		//GETTERS AND SETTERS
		public function get appStage() : DisplayObjectContainer
		{
			return _appStage;
		}
		
		public function set appStage(appStage : DisplayObjectContainer) : void
		{
			_appStage = appStage;
		}

		public function get layers() : Object
		{
			return _layers;
		}
		
		public function set layers(layers : Object) : void
		{
			_layers = layers;
		}
		
		public function get defaultLayer() : DisplayObjectContainer
		{
			return _defaultLayer;
		}
		
		public function set defaultLayer(defaultLayer : DisplayObjectContainer) : void
		{
			_defaultLayer = defaultLayer;
		}
		
		public function get defaultPreloaderLayer() : DisplayObjectContainer
		{
			return _defaultPreloaderLayer;
		}
		
		public function set defaultPreloaderLayer(defaultPreloaderLayer : DisplayObjectContainer) : void
		{
			_defaultPreloaderLayer = defaultPreloaderLayer;
		}
	}
}
